<?php

namespace App\Kuafu\Category\Controller\Pos;

use App\Kuafu\Category\Service\CategoryService;
use App\Kuafu\Shop\Service\ShopService;
use Illuminate\Http\Request;
use App\Kuafu\Base\Controller\BaseController;

class CategoryController extends BaseController
{
    public function lists(Request $request)
    {
        $brandId = (int)$request->header('brandId');
        $shopId  = (int)$request->header('shopId');

        $menuId = ShopService::getShopInfo($shopId)->menuId ?? 0;

        $data['lists'] = CategoryService::getCategoryList($brandId, $menuId, ['id', 'name', 'sort']);
        return $this->success($data);
    }
}
